// 引入 request 文件
import request from '@/utils/request.js'

// 微信登录捏
export const wxLoginB = (data) => {
	return request({
		url: '/apis/wxLogin',
		method: 'POST',
		data: data,
	})
}

// 获取微信用户信息
export const getUserInf = (data) => {
	return request({
		url: '/apis/userInfo',
		method: 'GET',
		data: data,
	})
}

// 更新微信用户信息
export const updateUserInf = (data) => {
	return request({
		url: '/apis/userInfo',
		method: 'POST',
		data: data,
	})
}

// 新建帖子
export const newPost = (data) => {
	return request({
		url: '/apis/newPost',
		method: 'POST',
		data: data,
	})
}

// 获取帖子列表
export const getPostsType = (data) => {
	return request({
		url: '/apis/getPostItems',
		method: 'POST',
		data: data,
	})
}

// 获取帖子详情
export const getPostDetail = (data) => {
	return request({
		url: '/apis/getPostItemById',
		method: 'GET',
		data: data,
	})
}

// 获取用户帖子列表
export const getPostListByUserId = (data) => {
	return request({
		url: '/apis/getPostItemByUserId',
		method: 'POST',
		data: data,
	})
}

export const postUpdatePostStatu = (data) => {
	return request({
		url: '/apis/updatePostItemStatu',
		method: 'POST',
		data: data,
	})
}

// 删除帖子
export const deletePost = (data) => {
	return request({
		url: '/apis/deletePostItemById',
		method: 'DELETE',
		query: data,
	})
}

// 评论帖子
export const newComments = (data) => {
	return request({
		url: '/comments/new',
		method: 'POST',
		data: data,
	})
}

// 获取帖子评论
export const getPostComments = (data) => {
	return request({
		url: '/comments/query',
		method: 'GET',
		data: data,
	})
}

// 删除评论
export const deleteComments = (data) => {
	return request({
		url: '/comments/delete',
		method: 'DELETE',
		query: data,
	})
}